#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
#include <string>
using namespace std;

struct airCraft
{
    string id;
    double x;
    double y;
};

double getDistance(airCraft a1, airCraft a2) {
    double result = hypot(a1.x - a2.x, a1.y - a2.y);
    return result;
}

int main() {
    int times; cin >> times;
    vector<airCraft> airCrafts;
    for (int i = 0; i < times; i++) {
        string id; double x, y;
        cin >> id >> x >> y;
        airCraft curr { id, x, y };
        airCrafts.push_back(curr);
    }
    int indexL = 0; int indexR = 1;
    double distance = getDistance(airCrafts[0], airCrafts[1]);
    for (int i = 0; i < times; i++) {
        for (int j = i + 1; j < times; j++) {
            double currDistance = getDistance(airCrafts[i], airCrafts[j]);
            if (currDistance < distance) {
                indexL = i; indexR = j;
                distance = currDistance;
            }
        }
    }
    cout << airCrafts[indexL].id << "-" << airCrafts[indexR].id << " ";
    cout << fixed << setprecision(4) << distance;
    return 0;
}